package com.ruiyi.adrobot.beans.socket;

import com.alibaba.fastjson.JSONObject;
import com.ruiyi.adrobot.utils.DesUtils;

public class SocketRequest<T> {
    private String method;
    private T params;

    public T getParams() {
        return params;
    }

    public void setParams(T params) {
        this.params = params;
    }

    public SocketRequest(String method, T params) {
        this.method = method;
        this.params = params;
    }

    /**
     * @return the method
     */
    public String getMethod() {
        return method;
    }

    /**
     * @param method the method to set
     */
    public void setMethod(String method) {
        this.method = method;
    }


    @Override
    public String toString() {
        JSONObject json = new JSONObject();
        json.put("method", method);
        json.put("params", params);
        try {
            return DesUtils.encrypt(json.toString()) + "###";
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

}
